﻿@model VietPremier.Models.LeftMenuModel
@{
    Layout = null;
}

<script>
    $('#search').click(function () {
        document.location = '@Url.Action("Search", "Destination")';
    });
</script>
@*<script type="text/javascript">

    function country() {
        var CountryName = $("#CountryName").val();
        $("#Country").val(CountryName);
        return false;
    }
</script>
<div class="box">
                    	<div class="boxlabel">Tours</div><!--/ .boxlabel-->
                        <div class="box-cont">
                            <div class="btn-group">
                                <button class="btndie " tabindex="-1">Country</button>
                                <button class="btncaret dropdown-toggle" tabindex="-1" data-toggle="dropdown">
                                    <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu">
                                    <li><a href="#">Viet Nam</a></li>
                                    <li><a href="#">Laos</a></li>
                                    <li><a href="#">Campodia</a></li>
                                    <li><a href="#">Thailans</a></li>
                                 </ul>
                             </div><!--/ .btn-group-->
                            <div class="btn-group">
                                <button id="Country" class="btndie " tabindex="-1">Country</button>
                                <button class="btncaret dropdown-toggle" tabindex="-1" data-toggle="dropdown">
                                    <span class="caret"></span>
                                </button>
                              
                                 <ul class="dropdown-menu">
                                     @{foreach(var item in Model.listCountry)
                                       {
                                           @Html.HiddenFor(modelitem => item.Id, new { @id = "CountryName", @name = "CountryName" })
                                           <li onclick="return country() "><a href="#">@item.Name</a></li>
                                       }
                                       }
                                   
                                 </ul>                           
                             </div><!--/ .btn-group-->
                            
                             <div class="btn-group">
                                <button id="Style" class="btndie " tabindex="-1">Travel style</button>
                                <button class="btncaret dropdown-toggle" tabindex="-1" data-toggle="dropdown">
                                    <span class="caret"></span>
                                </button>
                               <ul class="dropdown-menu">
                                     @{foreach(var item in Model.listStyle)
                                       {
                                           @Html.HiddenFor(modelitem=>item.Id, new { @id = "StyleName", @name = "StyleName" })
                                           <li><a href="#">@item.Name</a></li>
                                       }
                                       }
                                   
                                 </ul>   
                             </div><!--/ .btn-group-->
                             <div class="btn-group">
                                <button id="Duration" class="btndie " tabindex="-1">
                                 Duration
                                </button>
                                <button class="btncaret dropdown-toggle" tabindex="-1" data-toggle="dropdown">
                                    <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu">
                                     @{foreach(var item in Model.listTime)
                                       {
                                           @Html.HiddenFor(modelitem=>item.Id, new { @id = "Time", @name = "Time" })
                                           <li><a href="#">@item.Name</a></li>
                                       }
                                       }
                                   
                                 </ul>  
                             </div><!--/ .btn-group-->
                             <button class="btn btn-warning pull-right btn-small" type="button"> Search </button>
                             <div class="clear"></div>
                    	 </div><!--/ .box-cont-->
                    </div>*@

<div class="box">
    <div class="boxlabel">Tìm kiếm địa điểm</div>
    <!--/ .boxlabel-->
    <script>
        !function ($) {
            $(function () {
                $('.getData').find('a').click(function (event) {
                    var id = $(this).attr('id'),
                        text = $(this).html();
                    $(this).parents('.btn-group').find('.btndie').text(text).val(id);
                    event.preventDefault();
                });
            })
        }(window.jQuery)
    </script>
    <div class="box-cont">
        <div class="btn-group">
            <button id="Product" class="btndie" tabindex="-1" value="">Sản phẩm</button>
            <button class="btncaret dropdown-toggle" tabindex="-1" data-toggle="dropdown">
                <span class="caret"></span>
            </button>
            <ul class="dropdown-menu getData">
                @{
                                        
                    foreach (var item in Model.listProduction)
                    {
                    <li><a href="#" id="@item.Id">@item.Name</a></li>
                    }
                }

            </ul>
        </div>
        <!--/ .btn-group-->

        <div class="btn-group">
            <button id="Style" class="btndie " tabindex="-1">Phong cách</button>
            <button class="btncaret dropdown-toggle" tabindex="-1" data-toggle="dropdown">
                <span class="caret"></span>
            </button>
            <ul class="dropdown-menu getData">
                @{
                                        
                    foreach (var item in Model.listStyle)
                    {
                    <li><a href="#" id="@item.Id">@item.Name</a></li>
                    }
                }

            </ul>
        </div>
        <!--/ .btn-group-->
        <div class="btn-group">
            <button id="Destination" class="btndie " tabindex="-1">Thời gian</button>
            <button class="btncaret dropdown-toggle" tabindex="-1" data-toggle="dropdown">
                <span class="caret"></span>
            </button>
            <ul class="dropdown-menu getData">
                @{
                                        
                    foreach (var item in Model.listTime)
                    {
                    <li><a href="#" id="@item.Time">@item.Time</a></li>
                    }
                }
            </ul>
        </div>
        <!--/ .btn-group-->
        <script>
            function search() {
                var idProduct = $("#Product").val();
                var idStyle = $("#Style").val();
                var Time = $("#Destination").val();


                var url = '@Url.Action("Search", "TravelInformation", new { idProduct = "-1", idStyle = "-2", Time = "-3" })';


                url = url.replace("-1", idProduct);
                url = url.replace("-2", idStyle);
                url = url.replace("-3", Time);
                url = url.replace("amp;", "");
                url = url.replace("amp;", "");             
                window.location.href = url;

            }
        </script>
        <button id="search" class="btn btn-warning pull-right btn-small" type="button" onclick="return search()">Tìm kiếm</button>
        <div class="clear"></div>
    </div>
    <!--/ .box-cont-->
</div>
<!--/ .box-->
